package com.example.JPetStore.common;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000119641361";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key ="MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCztstG/e3ehIkk2gn2gYwFXrK814ipl/33j5mjgtwogTvLTL1frop9qUtGz3VdTAkfSQlKSCX3b5uIfRVR+alP/UY+yaM/si+e+9D1gEPJMiWaAX5rMrrdaFyPRaue3bBy3/A5awfBpa1viT8FXWnZelOsDuNQI4VBPstndB28vjD7po0yeNEJjV1mSO6TSI56GMBBpLplzYTUQ4lD3HW+zeGrG6aGzC38rDSAPn+dd8sd0NeyLHRGajyZux62dwKRwEXZqx4oRFn8ChLf04iDOQVqgUVAqUIdtF3kOIIWAxDAiWZ1q9UqrSDJX1t0OjgxXE6iR83iYIzLVU3jybiXAgMBAAECggEAE3r9DfT4k+ZJ93SrH81rICnjthSm+7s+DFfEj7TfqIRZtu/al0SUPorbXhGe5z4Wvw1rtGGdu/SdJ25noTsu3zzVIHk6+OyXvOQPAo2ky2pkKQ2AZp5ZIybs4Zrrv4zIU6tynsa7UIJlCnIWIr69epWH/F6gxU8UYr4rzksH7i2A5DA8JRuOHUGRlxNjTWUTn26DEIHJhEm0vzGKvfdrjgOl61pINiQqwRn3bOkbqVx7ExWCRJ/3kFyHC098VYKM46Mt+8mi87wmoA9QlIvpjJmf/hs0XeBZqwTCka4zwPyg7Rd23iqY3qgXe6z3WLFiQCaWFGkEgOd7YEzxmLP+AQKBgQDtY3epGysRglxzhEZgikyQpwCOz5pa/A1vaqruZRZtO1BvY6TWeLEaHRxiij9DBZaGQVgCKCLDBwoDaNmR3G8FqWqTBTgWu9zvp8yvMyNuem8Dfih7wu7P6nKAzayhi/7eIxsgqMhI7iwAyk8f1bwxwH3QwCmEM+d+m8kV2te6+wKBgQDBzcOivs9cnbBg7DV/BBHdX7PHZAcg7IRe5MHCq/T4LHSn79E08NSz+MLUBPgCRSLWwDLgIQU3k/w1cvO5pQa/kUTrXyEzVobA87zKKoILUCuSXYdmkb0Ono6inyrRADNodn9tYZfDQRUVe3GQv55+492wzWTisYAbvj0o1yiGFQKBgBV53zR8UbwmyAhnWhqXyG95vFIvM+6xSOHgi5A/svS03gUFxb7lclhDc/LyQODmW4TP2o9vZB2ywFQooy5P+/dOKWcdnMJpwoYn7xuWi8kN6IcvXag8rXA/7JX8hXaj/K3KDUU6H8yBR5fWtavSoVD68ib1i4v7SiEpJNsGTmgLAoGBALA/QDsw68N+ZHjAV6Y7PUPlVMlv3kvCzF7ACrXPS+imBTD0l31dxxIkmInYOvNVjGlgQOQzI1t36VVyRNP/kDOHGPY0fS0C82lmP7pbDgjbz8Q76ncM8rHo4C5kMbwAQsAtg5Ulu66F8Xan3I+Ws70R3Pp8z9KZObgBOf16LhBBAoGAOBkutBG/mpcYvVeqPt3lQ5IcRZ462wSVi+3qKvjlK3N7qwacu5wEGz0zYZkDT6Bc/iTWvzss0ha+L2m8gWk1QWxeQ0OwXA7iihNAenDbjXAnV5lPvxT/MZpjij28naFIyyhBS/e1qcw2H145pGLbY9VRr1Dw63G5OFqjfFwmZz0=";    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key ="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg0Ud8QaqJUX+0wIrKY68hBYEMTMIzyGL1rlvcvLVCSgqaNpG5O/jy/OO67L9jx9WS+g6FUCrTlx4XIGf9UUg924Ldvprh3pC4K9LyyrVwwWFS2chIz6xLDLHsMO77moE068csi5gqXXwJpeM103l2z2AVJPEEw7Zd5gCa+/PhXXCjVrv39eTRllCAaemiStfkL84Ym6XTsp7hiLF6GGqKRiaEBJaIWNgvtiG0SKJKHA18JlTFeT3PHZK+c48QEe3m3h3+A2HeOX0HMkj95P/JeUVvXVZaw8L2EKSivOpseCS8w0y/QoAisCMSXvE5sJR988YA/SaIBA5OK+qV13wAQIDAQAB";
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";


    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
//    public static String return_url = "http://localhost:8080/manager/index.html";
    public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
